<?php

$objXajax->registerFunction("cusfrmreportpay_loadGrid");
//$objXajax->registerFunction("cusfrmreportpay_type");
    
function cusfrmreportpay_loadGrid($fromdate,$todate){     

    global $lang;
    $objResponse = new xajaxResponse();// dong luon luon co khi goi ham ajax
    $arrGrid = cusfrmreportpay_getGrid($fromdate,$todate);
    $oTbs = new clsTinyButStrong();
    $oTbs->LoadTemplate('templates/'.$lang.'/customer/cus_reportpay_grid.html');
    $oTbs->MergeBlock('blk_data', $arrGrid);
    $oTbs->Show(TBS_NOTHING);
    $objResponse->addAssign('cusfrmreportpay_divGrid', 'innerHTML', $oTbs->Source);
    $objResponse->addScriptCall("dataTableObj.CreatDataTable('cusfrmreportpay_tbl',true);");
    $objResponse->addScript('changeWaiting(1);');                              
    return $objResponse->getXML(); // dong luon luon co khi goi ham ajax   
}

function  cusfrmreportpay_getGrid($fromdate,$todate){
    global $objDbSelect,$lang,$tbl_postfix,$user_id,$hotel_id;
    $sqlSelect = " SELECT *,datediff(now(),date_created) as today 
    FROM cus_pay  WHERE  datediff('$fromdate',date_created)<=0 and 
    datediff('$todate',date_created)>=0 and service_id = $hotel_id  order by date_created desc";
    //echo $sqlSelect; die();
    return $objDbSelect->GetArray($sqlSelect);
} 
# end region process data
?>
